package com.xsherl.leetcode.solution;

import com.xsherl.leetcode.base.TreeNode;

public class MaximumDepthOfBinaryTree {

    public int maxDepth(TreeNode root) {
        if (root == null){
            return 0;
        }
        return Math.max(maxDepth(root.left), maxDepth(root.right)) + 1;
    }

    public static void main(String[] args) {
        TreeNode root = TreeNode.buildTree(3,9,20,null,null,15,7);
        int i = new MaximumDepthOfBinaryTree().maxDepth(root);
        System.out.println(i);
    }
}
